package com.sjqi.demo.executor;

import com.sjqi.demo.config.Configuration;

import java.util.List;

/**
 * @author qishaojun
 */
public class CachingExecutor implements Executor {
    private Executor executor;
    /**
     * 可以处理二级缓存
     *
     * @param configuration
     * @param mapStatement
     * @param <T>
     * @return
     */
    @Override
    public <T> List<T> query(Configuration configuration, MappedStatement mapStatement) {
        //先获取二级缓存对象，二级缓存没有则继续调用执行器的逻辑
        return executor.query(configuration,mapStatement);
    }
}
